package net.sourceforge.peers.sip.syntaxencoding;

import java.util.List;

/**
 * 多个头字段值 field-value
 */
public class SipHeaderFieldMultiValue extends SipHeaderFieldValue {

    private final List<SipHeaderFieldValue> values;

    private static String toString(List<SipHeaderFieldValue> list) {
        if (list == null) {
            return null;
        }
        String arrToString = list.toString();
        return arrToString.substring(1, arrToString.length() - 1);
    }

    public SipHeaderFieldMultiValue(List<SipHeaderFieldValue> values) {
        super(toString(values));
        this.values = values;
    }

    public List<SipHeaderFieldValue> getValues() {
        return values;
    }

    @Override
    public String toString() {
        return toString(values);
    }
}
